#include"Energy.h"

/**
* @brief: Corrosion and expansion of images  此函数对图像进行腐蚀与膨胀操作（装甲板）
* @param: const Mat& src     源图像的引用
* @return: NONE
*/
void Energy::ArmorDilate(cv::Mat& src) {
        Mat element_dilate_1 = getStructuringElement(MORPH_RECT, Size(5, 5));
        Mat element_erode_1 = getStructuringElement(MORPH_RECT, Size(2, 2));
        Mat element_dilate_2 = getStructuringElement(MORPH_RECT, Size(3, 3));
        Mat element_erode_2 = getStructuringElement(MORPH_RECT, Size(2, 2));
        Mat element_dilate_3 = getStructuringElement(MORPH_RECT, Size(3, 3));
        Mat element_erode_3 = getStructuringElement(MORPH_RECT, Size(1, 1));

        dilate(src, src, element_dilate_1);
        erode(src, src, element_erode_1);

}

/**
* @brief: Corrosion and expansion of images  此函数对图像进行腐蚀与膨胀操作（扇叶流动条）
* @param: const Mat& src     源图像的引用
* @return: NONE
*/
void Energy::FlowStripFanDilate(cv::Mat& src) {
        Mat element_dilate_1 = getStructuringElement(MORPH_RECT, Size(5, 5));
        Mat element_erode_1 = getStructuringElement(MORPH_RECT, Size(2, 2));
        Mat element_dilate_2 = getStructuringElement(MORPH_RECT, Size(3, 3));
        Mat element_erode_2 = getStructuringElement(MORPH_RECT, Size(2, 2));
        Mat element_dilate_3 = getStructuringElement(MORPH_RECT, Size(3, 3));
        Mat element_erode_3 = getStructuringElement(MORPH_RECT, Size(1, 1));

        dilate(src, src, element_dilate_1);
        erode(src, src, element_erode_1);
        erode(src, src, element_erode_2);
        erode(src, src, element_erode_3);
}

/**
* @brief: Corrosion and expansion of images  此函数对图像进行腐蚀与膨胀操作（扇叶）
* @param: const Mat& src     源图像的引用
* @return: NONE
*/
void Energy::FanDilate(cv::Mat& src) {
        Mat element_dilate_1 = getStructuringElement(MORPH_RECT, Size(5, 5));
        Mat element_erode_1 = getStructuringElement(MORPH_RECT, Size(2, 2));
        Mat element_dilate_2 = getStructuringElement(MORPH_RECT, Size(3, 3));
        Mat element_erode_2 = getStructuringElement(MORPH_RECT, Size(2, 2));
        Mat element_dilate_3 = getStructuringElement(MORPH_RECT, Size(3, 3));
        Mat element_erode_3 = getStructuringElement(MORPH_RECT, Size(1, 1));

        dilate(src, src, element_dilate_1);
        erode(src, src, element_erode_1);
        erode(src, src, element_erode_2);
        erode(src, src, element_erode_3);
}



/**
* @brief: Corrosion and expansion of images  此函数对图像进行腐蚀与膨胀操作（流动条）
* @param: const Mat& src     源图像的引用
* @return: NONE
*/
void Energy::FlowStripDilate(cv::Mat& src) {
        Mat element_dilate_1 = getStructuringElement(MORPH_RECT, Size(5, 5));
        Mat element_erode_1 = getStructuringElement(MORPH_RECT, Size(2, 2));
        Mat element_dilate_2 = getStructuringElement(MORPH_RECT, Size(3, 3));
        Mat element_erode_2 = getStructuringElement(MORPH_RECT, Size(2, 2));
        Mat element_dilate_3 = getStructuringElement(MORPH_RECT, Size(3, 3));
        Mat element_erode_3 = getStructuringElement(MORPH_RECT, Size(1, 1));

        dilate(src, src, element_dilate_1);
        erode(src, src, element_erode_1);
        erode(src, src, element_erode_2);
        erode(src, src, element_erode_3);
}
/**
* @brief: Corrosion and expansion of images  此函数对图像进行腐蚀与膨胀操作（风车中心区域）
* @param: const Mat& src     源图像的引用
* @return: NONE
*/-----------------------------------------------------------------------------------------------------------------
void Energy::CenterRDilate(cv::Mat& src) {
        Mat element_dilate_1 = getStructuringElement(MORPH_RECT, Size(4, 4));
        Mat element_erode_1 = getStructuringElement(MORPH_RECT, Size(2, 1));
        Mat element_dilate_2 = getStructuringElement(MORPH_RECT, Size(3, 3));
        Mat element_erode_2 = getStructuringElement(MORPH_RECT, Size(4, 4));

        erode(src, src, element_erode_1);
        dilate(src, src, element_dilate_1);
}
